<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
  <head>
    <base href="<%=basePath%>">
    
	<title>投放的广告信息</title>    
	
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
    <link rel="stylesheet" type="text/css" href="res/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="res/css/bootstrap-responsive.min.css">
    <link rel="stylesheet" type="text/css" href="res/css/style.css">
    <script type="text/javascript" src="res/js/jquery-1.9.1.min.js"></script>

  </head>
  
  <body>
    
    <%@include file="../template/header.jsp" %>
    
    <div class="subHead">
        <div class="container">
            <h1>广告商管理后台</h1>
            <p class="lead">广告商可以在此投放广告、查看广告展现情况等。</p>
        </div>
    </div>
    <div class="row mainContent">
        
        <%@include file="../template/advertisementNav.jsp" %>
        
        <div class="span9">
            <legend class="text-warning">待机界面广告</legend>
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>#</th>
                    <th>名称</th>
                    <th>出价</th>
                    <th>状态</th>
                    <th>已展现次数</th>
                    <th>期望展现次数</th>
                    <th>投放时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                	<s:iterator value="#request.saverScreenAdvertisements " id="advertisement" status="statu">
                		<tr>
			                <td><s:property value="#statu.index + 1" /></td>
			                <td><s:property value="#advertisement.title" /></td>
			                <td><s:property value="#advertisement.bid" /></td>
			                <td>
			                	<s:if test="#advertisement.state == 0">
			                		投放中...
			                	</s:if>
			                	<s:elseif test="#advertisement.state == 1">
			                		审批中...
			                	</s:elseif>
			                	<s:elseif test="#advertisement.state == 2">
			                		余额不足
			                	</s:elseif>
			                	<s:else>
			                		展现完成
			                	</s:else>
			                </td>
			                <td><s:property value="#advertisement.realityShowNum" /></td>
			                <td><s:property value="#advertisement.expectShowNum" /></td>
			                <td><s:property value="#advertisement.publishDate" /></td>
			                <td>
			                	<s:if test="#advertisement.state == 0">
			                		<a href="advertisement/groundingAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">放弃投放</a>
			                	</s:if>
			                	<s:elseif test="#advertisement.state == 1">
			                		<a href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">放弃投放</a>
			                	</s:elseif>
			                	<s:elseif test="#advertisement.state == 2">
			                		<a href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">充值</a>
			                		<a href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">放弃投放</a>
			                	</s:elseif>
			                	<s:else>
			                		<a href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">增加次数</a>
			                		<a href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">放弃投放</a>
			                	</s:else>
			                	
			                	&nbsp;&nbsp;<a name="delete" href="advertisement/deleteAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">删除</a>
			                </td>
			            </tr>
                	</s:iterator>
                </tbody>
            </table>

            <legend class="text-warning">点单界面广告</legend>
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>#</th>
                    <th>名称</th>
                    <th>出价</th>
                    <th>状态</th>
                    <th>已展现次数</th>
                    <th>期望展现次数</th>
                    <th>投放时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                	<s:iterator value="#request.mainScreenAdvertisements " id="advertisement" status="statu">
                		<tr>
			                <td><s:property value="#statu.index + 1" /></td>
			                <td><s:property value="#advertisement.title" /></td>
			                <td><s:property value="#advertisement.bid" /></td>
			                <td>
			                	<s:if test="#advertisement.state == 0">
			                		<span class="badge badge-info">投放中...</span>
			                	</s:if>
			                	<s:elseif test="#advertisement.state == 1">
			                		<span class="badge badge-warning">审批中...</span>
			                	</s:elseif>
			                	<s:elseif test="#advertisement.state == 2">
			                		<span class="badge badge-important">余额不足</span>
			                	</s:elseif>
			                	<s:elseif test="#advertisement.state == 3">
			                		<span class="badge badge-success">展现完成</span>
			                	</s:elseif>
			                	<s:else>
			                		放弃投放
			                	</s:else>
			                </td>
			                <td><s:property value="#advertisement.realityShowNum" /></td>
			                <td><s:property value="#advertisement.expectShowNum" /></td>
			                <td><s:property value="#advertisement.publishDate" /></td>
			                <td>
			                	<s:if test="#advertisement.state == 0">
			                		<a class="btn btn-small btn-warning"
			                			href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />&state=0">放弃投放</a>
			                	</s:if>
			                	<s:else>
			                	
			                		<s:if test="#advertisement.state == 1">
			                			<a class="btn btn-small btn-warning"
			                				href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />&state=1">放弃投放</a>
			                		</s:if>
			                		<s:elseif test="#advertisement.state == 2">
			                			<a class="btn btn-small btn-info"
			                				href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />&state=2">恢复投放</a>
			                		</s:elseif>
			                		<s:elseif test="#advertisement.state == 3">
			                			<a class="btn btn-small btn-success"
			                				href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />&state=3">继续展现</a>
			                		</s:elseif>
			                		
			                	</s:else>
			                	
			                	&nbsp;&nbsp;
			                	<a name="edit" title="查看明细" href="#"><i class="icon-info-sign"></i></a>
			                	&nbsp;&nbsp;
			                	<a name="delete" title="删除"
			                		href="advertisement/deleteAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />"><i class="icon-trash"></i></a>
			                </td>
			            </tr>
                	</s:iterator>
                </tbody>
            </table>
            
            <legend class="text-warning">小票界面广告</legend>
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>#</th>
                    <th>名称</th>
                    <th>出价</th>
                    <th>状态</th>
                    <th>已展现次数</th>
                    <th>期望展现次数</th>
                    <th>投放时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                	<s:iterator value="#request.receiptScreenAdvertisements " id="advertisement" status="statu">
                		<tr>
			                <td><s:property value="#statu.index + 1" /></td>
			                <td><s:property value="#advertisement.title" /></td>
			                <td><s:property value="#advertisement.bid" /></td>
			                <td>
			                	<s:if test="#advertisement.state == 0">
			                		投放中...
			                	</s:if>
			                	<s:elseif test="#advertisement.state == 1">
			                		审批中...
			                	</s:elseif>
			                	<s:elseif test="#advertisement.state == 2">
			                		余额不足
			                	</s:elseif>
			                	<s:else>
			                		展现完成
			                	</s:else>
			                </td>
			                <td><s:property value="#advertisement.realityShowNum" /></td>
			                <td><s:property value="#advertisement.expectShowNum" /></td>
			                <td><s:property value="#advertisement.publishDate" /></td>
			                <td>
			                	<s:if test="#advertisement.state == 0">
			                		<a href="advertisement/groundingAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">放弃投放</a>
			                	</s:if>
			                	<s:elseif test="#advertisement.state == 1">
			                		<a href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">放弃投放</a>
			                	</s:elseif>
			                	<s:elseif test="#advertisement.state == 2">
			                		<a href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">充值</a>
			                		<a href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">放弃投放</a>
			                	</s:elseif>
			                	<s:else>
			                		<a href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">增加次数</a>
			                		<a href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">放弃投放</a>
			                	</s:else>
			                	
			                	&nbsp;&nbsp;<a name="delete" href="advertisement/deleteAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />">删除</a>
			                </td>
			            </tr>
                	</s:iterator>
                </tbody>
            </table>
        </div>
    </div>

    <div class="footer">
        <p>版权所有： 银盒子计划团队</p>
    </div>

	<!-- Modal -->
	<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="myModalLabel">Modal header</h3>
		</div>
		<div class="modal-body">
			<p>One fine body…</p>
		</div>
		<div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
			<button class="btn btn-primary">Save changes</button>
		</div>
	</div>

    <script type="text/javascript" src="res/js/bootstrap.min.js"></script>
    <script type="text/javascript">
        $('a[name=delete]').each(function(){
            var that = $(this);
            that.on('click', function(){
                if(confirm('确定删除此商品？')){
                    return;
                }
                else {
                    return false;
                }
            });
        });
        
        
        function openEidtDialog(){
        	$('#myModal').modal('show');
        	return false;
        }
        
        $("li[name=advertisementNav]").each(function(){
        	var that = $(this);
        	that.removeClass("active");
        });
        
        $("#advertisementNav1").addClass("active");
    </script>
    
    
  </body>
</html>
